<html><head>
  <meta charset="utf-8">
    <#assign base=request.contextPath  />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <title>产康统计</title>
  <link rel="stylesheet" href="${base}/js/layui/css/layui.css" media="all">
  <style type="text/css">

  </style>
</head>
	<body>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
	  <legend>数据统计</legend>
	</fieldset>
	<div id="main" style="height:600px;padding: 40px;"></div>
<script src="${base}/js/layui/echarts.common.min.js"></script>
<script src="${base}/js/layui/layui.js " charset="utf-8"></script>
<script src="${base}/js/jquery.min.js"></script>
<script src="${base}/js/zhang.js"></script>
<script>
var bas="${base}"
var home_data=getDataByDicCode(bas,"home")
for(var i=0;i<home_data.length;i++){
$("#home").append(
'  <option value="'+home_data[i].id+'">'+home_data[i].name+'</option>'
)
}
var data1Arr=[];
var data2Arr=[];
layui.use(['rate'], function(){
var rate = layui.rate;
rate.render({
    elem: '#pingfen',
    theme: '#FE0000'
  })
});

//清空
initChar();
function initChar(){
     data2Arr=[];
     data1Arr=[];
$.ajax({
        type : "POST", //提交方式
        url : "${base}/relationProject/findRelationProject",//路径
        async:false,
        success : function(data) {//返回数据根据结果进行相应的处理
      //  alert(JSON.stringify(data))
     for(var i=0;i<data.length;i++){
     data2Arr.push(data[i].count);
     data1Arr.push(data[i].projectName);
     }
       var myChart = echarts.init(document.getElementById('main'));
             // 指定图表的配置项和数据
             var option = {
                 title: {
                     text: '产康项目统计'
                 },

                 tooltip: {
                         trigger: 'axis',
                         axisPointer: {
                         type: 'cross',
                         label: {
                             backgroundColor: '#283b56'
                             }
                         }
                 },
                 xAxis: {
                        data: data1Arr
                               },
                 yAxis: {},
                 series: [{
                     name: '销量',
                     type: 'bar',
                     barWidth: 35,
                     data: data2Arr
                 }]
             };
             myChart.setOption(option);
			}

        });
}
function findProject(){
 var resultdata;
   $.ajax({
          type:"POST",
          url:"${base}/relationProject/findRelationProject",
          async:false,
            success : function(data){
              resultdata=data;
            }
      });
      return resultdata;
 }
</script>
</body>
</html>